<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>File Source for xacl.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
											</head>
		<body>
						<h1>Source for file xacl.php</h1>
<p>Documentation is available at <a href="../default/_controllers_components_xacl_php.html">xacl.php</a></p>
<div class="src-code">
<pre><ol><li><a name="a1"></a><span class="src-php">&lt;?php </span></li>
<li><a name="a2"></a><span class="src-key">class </span><a href="../default/XaclComponent.html">XaclComponent</a> <span class="src-key">extends </span><span class="src-id">Object </span><span class="src-sym">{</span></li>
<li><a name="a3"></a>&nbsp;</li>
<li><a name="a4"></a>&nbsp;</li>
<li><a name="a5"></a>    <span class="src-key">var </span><a href="../default/XaclComponent.html#var$components">$components</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Session'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a6"></a>    <span class="src-key">var </span><a href="../default/XaclComponent.html#var$Tuser">$Tuser</a><span class="src-sym">;</span></li>
<li><a name="a7"></a>    <span class="src-key">var </span><a href="../default/XaclComponent.html#var$controller">$controller</a><span class="src-sym">;</span></li>
<li><a name="a8"></a>    <span class="src-key">var </span><a href="../default/XaclComponent.html#var$action_id">$action_id</a><span class="src-sym">;</span></li>
<li><a name="a9"></a>    <span class="src-key">var </span><a href="../default/XaclComponent.html#var$xaclData">$xaclData</a>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a10"></a>&nbsp;</li>
<li><a name="a11"></a>&nbsp;</li>
<li><a name="a12"></a>    <span class="src-comm">//在Controller::beforeFilter()之前被调用</span></li>
<li><a name="a12"></a>    </li>
<li><a name="a13"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodinitialize">initialize</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$controller</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a14"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$controller">controller</a> = <span class="src-sym">&amp;</span><span class="src-var">$controller</span><span class="src-sym">;</span></li>
<li><a name="a15"></a>&nbsp;</li>
<li><a name="a16"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$Tuser">Tuser</a> = <span class="src-id">ClassRegistry</span><span class="src-sym">::</span><span class="src-id">init</span><span class="src-sym">(</span><span class="src-str">'Tuser'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a17"></a>        <span class="src-var">$faction </span>= <span class="src-var">$controller</span><span class="src-sym">-&gt;</span><span class="src-id">name</span>.<span class="src-str">&quot;::&quot;</span>.<span class="src-var">$controller</span><span class="src-sym">-&gt;</span><span class="src-id">action</span><span class="src-sym">;</span></li>
<li><a name="a18"></a>        <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/method_exists">method_exists</a><span class="src-sym">(</span><span class="src-var">$controller</span><span class="src-sym">, </span><span class="src-var">$controller</span><span class="src-sym">-&gt;</span><span class="src-id">action</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a19"></a>            <span class="src-var">$Taction </span>= <span class="src-id">ClassRegistry</span><span class="src-sym">::</span><span class="src-id">init</span><span class="src-sym">(</span><span class="src-str">'Taction'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a20"></a>            <span class="src-var">$Taction</span><span class="src-sym">-&gt;</span><span class="src-id">action_collect</span><span class="src-sym">(</span><span class="src-var">$faction</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a21"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$action_id">action_id</a> = <span class="src-var">$Taction</span><span class="src-sym">-&gt;</span><span class="src-id">getActionIdByName</span><span class="src-sym">(</span><span class="src-var">$faction</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a22"></a>        <span class="src-sym">}</span></li>
<li><a name="a23"></a>&nbsp;</li>
<li><a name="a24"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$faction </span>!= <span class="src-str">'Tuser::out' </span>&amp;&amp; <span class="src-var">$faction </span>!= <span class="src-str">'Tuser::login' </span>&amp;&amp; <span class="src-var">$faction </span>!= <span class="src-str">'Tuser::reest'</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a25"></a>            <span class="src-comm">//print $faction;</span></li>
<li><a name="a26"></a>            <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">FALSE </span>== <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodcheck_login">check_login</a><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a27"></a>                <span class="src-comm">//$controller-&gt;flash(&quot;需要登录!&quot;, '/Tuser/login');</span></li>
<li><a name="a28"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodredirectSomewhere">redirectSomewhere</a><span class="src-sym">(</span><span class="src-str">'/tuser/login/'</span>.<a href="http://www.php.net/base64_encode">base64_encode</a><span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REDIRECT_URL'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-str">'需要登录'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a29"></a>&nbsp;</li>
<li><a name="a30"></a>                <span class="src-key">return</span><span class="src-sym">;</span></li>
<li><a name="a31"></a>                <span class="src-comm">//exit;</span></li>
<li><a name="a32"></a>            <span class="src-sym">}</span><span class="src-key">else</span><span class="src-sym">{</span></li>
<li><a name="a33"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$xaclData">xaclData</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodgetXaclData">getXaclData</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a34"></a>                <span class="src-var">$xaclData </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$xaclData">xaclData</a> <span class="src-sym">;</span></li>
<li><a name="a35"></a>                <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$action_id">action_id</a><span class="src-sym">,</span><span class="src-var">$xaclData</span><span class="src-sym">[</span><span class="src-str">'ACL'</span><span class="src-sym">]</span><span class="src-sym">))</span></li>
<li><a name="a36"></a>                <span class="src-sym">{</span></li>
<li><a name="a37"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodredirectSomewhere">redirectSomewhere</a><span class="src-sym">(</span><span class="src-str">'/tuser/reest/'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a38"></a>                    <span class="src-key">return</span><span class="src-sym">;</span></li>
<li><a name="a39"></a>                <span class="src-sym">}</span></li>
<li><a name="a40"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodload_menu">load_menu</a><span class="src-sym">(</span><span class="src-var">$controller</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a41"></a>            <span class="src-sym">}</span></li>
<li><a name="a42"></a>        <span class="src-sym">}</span></li>
<li><a name="a43"></a>    <span class="src-sym">}</span></li>
<li><a name="a44"></a>    <span class="src-comm">//在Controller::beforeFilter()之后被调用</span></li>
<li><a name="a44"></a>    </li>
<li><a name="a45"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodstartup">startup</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$controller</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a46"></a>    <span class="src-sym">}</span></li>
<li><a name="a47"></a>    <span class="src-doc">/**</span></li>
<li><a name="a48"></a><span class="src-doc">     * 通过 controller跳转</span></li>
<li><a name="a49"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$value </span><span class="src-doc">地址</span></li>
<li><a name="a50"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$txt </span><span class="src-doc">   flash提示信息</span></li>
<li><a name="a51"></a><span class="src-doc">     */</span></li>
<li><a name="a52"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodredirectSomewhere">redirectSomewhere</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">,</span><span class="src-var">$txt </span>= <span class="src-id">NULL</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a53"></a>        <span class="src-comm">// 使用控制器的方法</span></li>
<li><a name="a54"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-id">NULL </span>!=<a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$txt</span><span class="src-sym">))</span></li>
<li><a name="a55"></a>        <span class="src-sym">{</span></li>
<li><a name="a56"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$controller">controller</a><span class="src-sym">-&gt;</span><span class="src-id">flash</span><span class="src-sym">(</span><span class="src-var">$txt</span><span class="src-sym">,</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a57"></a>        <span class="src-sym">}</span><span class="src-key">else</span><span class="src-sym">{</span></li>
<li><a name="a58"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$controller">controller</a><span class="src-sym">-&gt;</span><span class="src-id">redirect</span><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a59"></a>        <span class="src-sym">}</span></li>
<li><a name="a60"></a>        <span class="src-key">return </span><span class="src-sym">;</span></li>
<li><a name="a61"></a>    <span class="src-sym">}</span></li>
<li><a name="a62"></a>&nbsp;</li>
<li><a name="a63"></a>    <span class="src-doc">/**</span></li>
<li><a name="a64"></a><span class="src-doc">     * 登录检测</span></li>
<li><a name="a65"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span></li>
<li><a name="a66"></a><span class="src-doc">     */</span></li>
<li><a name="a67"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodcheck_login">check_login</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a68"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">FALSE </span>== <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">Session</span><span class="src-sym">-&gt;</span><span class="src-id">read</span><span class="src-sym">(</span><span class="src-str">'is_login'</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a69"></a>            <span class="src-key">return </span><span class="src-id">FALSE</span><span class="src-sym">;</span></li>
<li><a name="a70"></a>        <span class="src-sym">}</span></li>
<li><a name="a71"></a>        <span class="src-key">return </span><span class="src-id">TRUE</span><span class="src-sym">;</span></li>
<li><a name="a72"></a>    <span class="src-sym">}</span></li>
<li><a name="a73"></a>    <span class="src-doc">/**</span></li>
<li><a name="a74"></a><span class="src-doc">      * 保存登录信息并跳转</span></li>
<li><a name="a75"></a><span class="src-doc">      *</span></li>
<li><a name="a76"></a><span class="src-doc">      * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$user </span><span class="src-doc">用户名</span></li>
<li><a name="a77"></a><span class="src-doc">      * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$url </span><span class="src-doc">   跳转地址</span></li>
<li><a name="a78"></a><span class="src-doc">      * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">bool </span></li>
<li><a name="a79"></a><span class="src-doc">      */</span></li>
<li><a name="a80"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodwrite_login">write_login</a><span class="src-sym">(</span><span class="src-var">$user </span>= <span class="src-id">NULL</span><span class="src-sym">,</span><span class="src-var">$url </span>=<span class="src-id">NULL</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a81"></a>        <span class="src-var">$url </span>= <span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$url</span><span class="src-sym">) </span>? <span class="src-str">'/tuser/index' </span>: <span class="src-var">$url</span><span class="src-sym">;</span></li>
<li><a name="a82"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">NULL </span>== <span class="src-var">$user</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a83"></a>            <span class="src-key">return </span><span class="src-id">FALSE</span><span class="src-sym">;</span></li>
<li><a name="a84"></a>        <span class="src-sym">}</span></li>
<li><a name="a85"></a>        <span class="src-var">$user_info </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$Tuser">Tuser</a><span class="src-sym">-&gt;</span><span class="src-id">findByUserName</span><span class="src-sym">(</span><span class="src-var">$user</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a86"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">Session</span><span class="src-sym">-&gt;</span><span class="src-id">write</span><span class="src-sym">(</span><span class="src-str">&quot;_user&quot;</span><span class="src-sym">, </span><span class="src-var">$user_info</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a87"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">Session</span><span class="src-sym">-&gt;</span><span class="src-id">write</span><span class="src-sym">(</span><span class="src-str">&quot;is_login&quot;</span><span class="src-sym">, </span><span class="src-id">TRUE</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a88"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodredirectSomewhere">redirectSomewhere</a><span class="src-sym">(</span><span class="src-var">$url</span><span class="src-sym">,</span><span class="src-str">&quot;登录成功!&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a89"></a>    <span class="src-sym">}</span></li>
<li><a name="a90"></a>&nbsp;</li>
<li><a name="a91"></a>    <span class="src-doc">/**</span></li>
<li><a name="a92"></a><span class="src-doc">     * 得到当前用户信息</span></li>
<li><a name="a93"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc">   </span><span class="src-doc-type">Array </span></li>
<li><a name="a94"></a><span class="src-doc">     */</span></li>
<li><a name="a95"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodcurrentUser">currentUser</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a96"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">FALSE </span>== <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">Session</span><span class="src-sym">-&gt;</span><span class="src-id">read</span><span class="src-sym">(</span><span class="src-str">'is_login'</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a97"></a>            <span class="src-comm">//$this-&gt;Session-&gt;write(&quot;ref&quot;, $where);</span></li>
<li><a name="a98"></a>            <span class="src-key">return </span><span class="src-id">FALSE</span><span class="src-sym">;</span></li>
<li><a name="a99"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a100"></a>            <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">Session</span><span class="src-sym">-&gt;</span><span class="src-id">read</span><span class="src-sym">(</span><span class="src-str">&quot;_user&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a101"></a>        <span class="src-sym">}</span></li>
<li><a name="a102"></a>&nbsp;</li>
<li><a name="a103"></a>    <span class="src-sym">}</span></li>
<li><a name="a104"></a>&nbsp;</li>
<li><a name="a105"></a>    <span class="src-doc">/**</span></li>
<li><a name="a106"></a><span class="src-doc">     *登出</span></li>
<li><a name="a107"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span></li>
<li><a name="a108"></a><span class="src-doc">     */</span></li>
<li><a name="a109"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodlogout">logout</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a110"></a>        <span class="src-var">$ref </span>= <span class="src-str">&quot;/tuser/login&quot;</span><span class="src-sym">;</span></li>
<li><a name="a111"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">Session</span><span class="src-sym">-&gt;</span><span class="src-id">destroy</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a112"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodredirectSomewhere">redirectSomewhere</a><span class="src-sym">(</span><span class="src-var">$ref</span><span class="src-sym">,</span><span class="src-str">&quot;登出成功!&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a113"></a>    <span class="src-sym">}</span></li>
<li><a name="a114"></a>    <span class="src-doc">/**</span></li>
<li><a name="a115"></a><span class="src-doc">     * 载入菜单</span></li>
<li><a name="a116"></a><span class="src-doc">     *</span></li>
<li><a name="a117"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">object </span><span class="src-doc-var">$controller </span></li>
<li><a name="a118"></a><span class="src-doc">     */</span></li>
<li><a name="a119"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodload_menu">load_menu</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$controller</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a120"></a>&nbsp;</li>
<li><a name="a121"></a>        <span class="src-var">$Tmenu </span>= <span class="src-id">ClassRegistry</span><span class="src-sym">::</span><span class="src-id">init</span><span class="src-sym">(</span><span class="src-str">'Tmenu'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a122"></a>        <span class="src-var">$data </span>= <span class="src-str">'['</span><span class="src-sym">;</span></li>
<li><a name="a123"></a>&nbsp;</li>
<li><a name="a124"></a>        <span class="src-var">$treeData </span>= <span class="src-var">$Tmenu</span><span class="src-sym">-&gt;</span><span class="src-id">getSubMenu</span><span class="src-sym">(</span><span class="src-str">'0'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a125"></a>        <span class="src-comm">// print_r($treeData);exit;</span></li>
<li><a name="a126"></a>        <span class="src-var">$data</span>.=<a href="http://www.php.net/join">join</a><span class="src-sym">(</span><span class="src-str">&quot;,&quot;</span><span class="src-sym">,</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodmktreeDta">mktreeDta</a><span class="src-sym">(</span><span class="src-var">$treeData</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a127"></a>        <span class="src-var">$data </span>.= <span class="src-str">']'</span><span class="src-sym">;</span></li>
<li><a name="a128"></a>&nbsp;</li>
<li><a name="a129"></a>        <span class="src-var">$controller</span><span class="src-sym">-&gt;</span><span class="src-id">set</span><span class="src-sym">(</span><span class="src-str">'menu_data'</span><span class="src-sym">, </span><span class="src-var">$data</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a130"></a>    <span class="src-sym">}</span></li>
<li><a name="a131"></a>    <span class="src-doc">/**</span></li>
<li><a name="a132"></a><span class="src-doc">     * 整理树菜单</span></li>
<li><a name="a133"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">Array </span><span class="src-doc-var">$data </span></li>
<li><a name="a134"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">Array </span></li>
<li><a name="a135"></a><span class="src-doc">     */</span></li>
<li><a name="a136"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodmktreeDta">mktreeDta</a><span class="src-sym">(</span><span class="src-var">$data</span><span class="src-sym">)</span></li>
<li><a name="a137"></a>    <span class="src-sym">{</span></li>
<li><a name="a138"></a>        <span class="src-var">$tmpArr </span>=<span class="src-key">Array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a139"></a>        <span class="src-var">$xaclData </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#var$xaclData">xaclData</a> <span class="src-sym">;</span></li>
<li><a name="a140"></a>&nbsp;</li>
<li><a name="a141"></a>        <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$data </span><span class="src-key">as </span><span class="src-var">$val</span><span class="src-sym">)</span></li>
<li><a name="a142"></a>        <span class="src-sym">{</span></li>
<li><a name="a143"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$val</span><span class="src-sym">[</span><span class="src-str">'f_name'</span><span class="src-sym">]</span><span class="src-sym">) </span>&amp;&amp; <a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$val</span><span class="src-sym">[</span><span class="src-str">'id'</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-var">$xaclData</span><span class="src-sym">[</span><span class="src-str">'MENU'</span><span class="src-sym">]</span><span class="src-sym">))</span></li>
<li><a name="a144"></a>            <span class="src-sym">{</span></li>
<li><a name="a145"></a>                <span class="src-var">$tmpArr</span><span class="src-sym">[</span><span class="src-sym">]</span>=<span class="src-str">&quot;['&quot;</span>.<a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$val</span><span class="src-sym">[</span><span class="src-str">'f_name'</span><span class="src-sym">]</span><span class="src-sym">)</span>.<span class="src-str">&quot;', '&quot;</span>.<a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><span class="src-var">$val</span><span class="src-sym">[</span><span class="src-str">'f_url'</span><span class="src-sym">]</span><span class="src-sym">)</span>.<span class="src-str">&quot;']&quot;</span><span class="src-sym">;</span></li>
<li><a name="a146"></a>                <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$val</span><span class="src-sym">[</span><span class="src-str">'sub'</span><span class="src-sym">]</span><span class="src-sym">) </span>&gt; <span class="src-num">0</span><span class="src-sym">)</span></li>
<li><a name="a147"></a>                <span class="src-sym">{</span></li>
<li><a name="a148"></a>                    <span class="src-var">$tmpArr</span><span class="src-sym">[</span><span class="src-sym">] </span>=<span class="src-str">&quot;[&quot;</span>.<a href="http://www.php.net/join">join</a><span class="src-sym">(</span><span class="src-str">','</span><span class="src-sym">,</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodmktreeDta">mktreeDta</a><span class="src-sym">(</span><span class="src-var">$val</span><span class="src-sym">[</span><span class="src-str">'sub'</span><span class="src-sym">]</span><span class="src-sym">))</span>.<span class="src-str">&quot;]&quot;</span><span class="src-sym">;</span></li>
<li><a name="a149"></a>                <span class="src-sym">}</span></li>
<li><a name="a150"></a>&nbsp;</li>
<li><a name="a151"></a>&nbsp;</li>
<li><a name="a152"></a>            <span class="src-sym">}</span></li>
<li><a name="a153"></a>        <span class="src-sym">}</span></li>
<li><a name="a154"></a>        <span class="src-key">return </span><span class="src-var">$tmpArr</span><span class="src-sym">;</span></li>
<li><a name="a155"></a>    <span class="src-sym">}</span></li>
<li><a name="a156"></a>    <span class="src-doc">/**</span></li>
<li><a name="a157"></a><span class="src-doc">     * 载入用户菜单、权限信息</span></li>
<li><a name="a158"></a><span class="src-doc">     *</span></li>
<li><a name="a159"></a><span class="src-doc">     * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">Array </span></li>
<li><a name="a160"></a><span class="src-doc">     */</span></li>
<li><a name="a161"></a>    <span class="src-key">function </span><a href="../default/XaclComponent.html#methodgetXaclData">getXaclData</a><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a162"></a>    <span class="src-sym">{</span></li>
<li><a name="a163"></a>&nbsp;</li>
<li><a name="a164"></a>        <span class="src-var">$result </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">Session</span><span class="src-sym">-&gt;</span><span class="src-id">read</span><span class="src-sym">(</span><span class="src-str">'_Xacl'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a165"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-id">NULL</span>==<span class="src-var">$result</span><span class="src-sym">)</span></li>
<li><a name="a166"></a>        <span class="src-sym">{</span></li>
<li><a name="a167"></a>            <span class="src-var">$result </span>=<span class="src-key">array</span></li>
<li><a name="a168"></a>            <span class="src-sym">(</span></li>
<li><a name="a169"></a>            <span class="src-str">&quot;ACL&quot;</span>=&gt;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a170"></a>            <span class="src-str">&quot;MENU&quot;</span>=&gt;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span></li>
<li><a name="a171"></a>            <span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a172"></a>            <span class="src-var">$user_info </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../default/XaclComponent.html#methodcurrentUser">currentUser</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a173"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-id">false </span>== <span class="src-var">$user_info</span><span class="src-sym">)</span></li>
<li><a name="a174"></a>            <span class="src-sym">{</span></li>
<li><a name="a175"></a>                <span class="src-key">return </span><span class="src-var">$result</span><span class="src-sym">;</span></li>
<li><a name="a176"></a>            <span class="src-sym">}</span></li>
<li><a name="a177"></a>            <span class="src-var">$uid </span>= <span class="src-var">$user_info</span><span class="src-sym">[</span><span class="src-str">'Tuser'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'id'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a178"></a>&nbsp;</li>
<li><a name="a179"></a>            <span class="src-var">$Tusergrouprelation </span>= <span class="src-id">ClassRegistry</span><span class="src-sym">::</span><span class="src-id">init</span><span class="src-sym">(</span><span class="src-str">'Tusergrouprelation'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a180"></a>            <span class="src-var">$Tmenugrouprelation </span>= <span class="src-id">ClassRegistry</span><span class="src-sym">::</span><span class="src-id">init</span><span class="src-sym">(</span><span class="src-str">'Tmenugrouprelation'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a181"></a>            <span class="src-var">$Tactiongrouprelation </span>= <span class="src-id">ClassRegistry</span><span class="src-sym">::</span><span class="src-id">init</span><span class="src-sym">(</span><span class="src-str">'Tactiongrouprelation'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a182"></a>&nbsp;</li>
<li><a name="a183"></a>            <span class="src-var">$usergroups </span>=<span class="src-var">$Tusergrouprelation</span><span class="src-sym">-&gt;</span><span class="src-id">getUserGroups</span><span class="src-sym">(</span><span class="src-var">$uid</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a184"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$usergroups</span><span class="src-sym">))</span></li>
<li><a name="a185"></a>            <span class="src-sym">{</span></li>
<li><a name="a186"></a>                <span class="src-key">return </span><span class="src-var">$result</span><span class="src-sym">;</span></li>
<li><a name="a187"></a>            <span class="src-sym">}</span></li>
<li><a name="a188"></a>            <span class="src-var">$conditions </span>= <span class="src-str">&quot;f_gid in('&quot;</span>.<a href="http://www.php.net/join">join</a><span class="src-sym">(</span><span class="src-str">&quot;','&quot;</span><span class="src-sym">,</span><span class="src-var">$usergroups</span><span class="src-sym">)</span>.<span class="src-str">&quot;') &quot;</span><span class="src-sym">;</span></li>
<li><a name="a189"></a>            <span class="src-var">$rs1 </span>= <span class="src-var">$Tmenugrouprelation</span><span class="src-sym">-&gt;</span><span class="src-id">findAll</span><span class="src-sym">(</span><span class="src-var">$conditions</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a190"></a>            <span class="src-var">$rs2 </span>= <span class="src-var">$Tactiongrouprelation</span><span class="src-sym">-&gt;</span><span class="src-id">findAll</span><span class="src-sym">(</span><span class="src-var">$conditions</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a191"></a>&nbsp;</li>
<li><a name="a192"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-num">0</span>&lt;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$rs1</span><span class="src-sym">))</span></li>
<li><a name="a193"></a>            <span class="src-sym">{</span></li>
<li><a name="a194"></a>                <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$rs1 </span><span class="src-key">as </span><span class="src-var">$v1</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a195"></a>                    <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$v1</span><span class="src-sym">[</span><span class="src-str">'Tmenugrouprelation'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'f_mid'</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-var">$result</span><span class="src-sym">[</span><span class="src-str">'MENU'</span><span class="src-sym">]</span><span class="src-sym">))</span></li>
<li><a name="a196"></a>                    <span class="src-sym">{</span></li>
<li><a name="a197"></a>                        <span class="src-var">$result</span><span class="src-sym">[</span><span class="src-str">'MENU'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-var">$v1</span><span class="src-sym">[</span><span class="src-str">'Tmenugrouprelation'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'f_mid'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a198"></a>                    <span class="src-sym">}</span></li>
<li><a name="a199"></a>                <span class="src-sym">}</span></li>
<li><a name="a200"></a>            <span class="src-sym">}</span></li>
<li><a name="a201"></a>&nbsp;</li>
<li><a name="a202"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-num">0</span>&lt;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$rs2</span><span class="src-sym">))</span></li>
<li><a name="a203"></a>            <span class="src-sym">{</span></li>
<li><a name="a204"></a>                <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$rs2 </span><span class="src-key">as </span><span class="src-var">$v2</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a205"></a>                    <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$v2</span><span class="src-sym">[</span><span class="src-str">'Tactiongrouprelation'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'f_aid'</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-var">$result</span><span class="src-sym">[</span><span class="src-str">'ACL'</span><span class="src-sym">]</span><span class="src-sym">))</span></li>
<li><a name="a206"></a>                    <span class="src-sym">{</span></li>
<li><a name="a207"></a>                        <span class="src-var">$result</span><span class="src-sym">[</span><span class="src-str">'ACL'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-var">$v2</span><span class="src-sym">[</span><span class="src-str">'Tactiongrouprelation'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'f_aid'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a208"></a>                    <span class="src-sym">}</span></li>
<li><a name="a209"></a>                <span class="src-sym">}</span></li>
<li><a name="a210"></a>            <span class="src-sym">}</span></li>
<li><a name="a211"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">Session</span><span class="src-sym">-&gt;</span><span class="src-id">write</span><span class="src-sym">(</span><span class="src-str">'_Xacl'</span><span class="src-sym">,</span><span class="src-var">$result</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a212"></a>            unset<span class="src-sym">(</span><span class="src-var">$Tusergrouprelation</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a213"></a>            unset<span class="src-sym">(</span><span class="src-var">$Tmenugrouprelation</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a214"></a>            unset<span class="src-sym">(</span><span class="src-var">$Tactiongrouprelation</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a215"></a>        <span class="src-sym">}</span></li>
<li><a name="a216"></a>        <span class="src-key">return </span><span class="src-var">$result</span><span class="src-sym">;</span></li>
<li><a name="a217"></a>    <span class="src-sym">}</span></li>
<li><a name="a218"></a><span class="src-sym">}</span></li>
<li><a name="a219"></a><span class="src-php">?&gt;</span></li>
</ol></pre>
</div>
	<p class="notes" id="credit">
		Documentation generated on Tue, 04 Aug 2009 07:38:02 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>
	</p>
	</body>
</html>